Universal Access To All Knowledge
Home Donate | Store | Blog | FAQ | Jobs | Volunteer Positions | Contact | Bios | Forums | Projects | Terms, Privacy, & Copyright
Search: Advanced Search
Anonymous User (login or join us)
Upload

Reply to this post | Go Back
View Post [edit]

Poster: ferren Date: Apr 1, 2013 10:11am
Forum: forums Subject: DjVu

This is a technical question about the details of displaying DjVu. I don't know where it should be posted. Please forward if you have a better place in mind!

I downloaded Schweitzer's _The Quest for the Historical Jesus_, http://archive.org/details/questofhistorica00schwrich

The pages are badly yellowed and text contrast low as a result. But occasionally when displaying a new page, it comes up with black-on-white text, much easier to read--and then it adds the yellow-brown background. This indicates that there is a way to get black-on-white text easily from scanned DjVu documents. It seems worthwhile to me to investigate this as a viewing option, but I don't know where to take this idea. Any thoughts?

Reply to this post
Reply [edit]

Poster: aibek Date: Apr 2, 2013 9:32am
Forum: forums Subject: Re: DjVu

A nice idea!

In djvu files, each page is stored in three separate images: a foreground+mask and a background. (Check the two links below.) The black-on-white page you see momentarily is due to your Djvu reader combining the images sluggishly. The black-on-white thing is the mask file, or the foreground-image file (I have not investigated which of the two, but it does not matter), and the yellow background is from the background-image being added later.

So you can just extract the mask or the foreground from each page, combine them into a single pdf file, say, and use that as your book.

The catch is that the the scanned image is separated into the three images (foreground, mask and backg.) automatically, so you cannot be sure that the mask file contains all that you are interested in. It would thus not do for archival purposes, but I suppose for "everyday purposes" it is fine, as when in doubt you can always check the original file.

I have attached the mask and foreground images for p.11 of the book. The sizes of the pdf files are: 11-mask.pdf: 65 KB; 11-foreground.pdf: 413 KB. (IA refuses to accept the background image, size 2.5 MB, for some reason. It is essentially just a yellow page.)

The program ddjvu, which I used to extract the images, has a handy one-step solution to your problem:

ddjvu -format=pdf -mode=mask questofhistorica00schwrich.djvu output.pdf

This internally extracts the mask images for all the pages, outputs a pdf corresponding to each, and then concatenates them all in one file. (So, what you get is just an output.pdf file.) Check ddjvu man page for more.

Feel free to ask for more help!

---
http://archive.org/post/481145/ia-pdf-files
http://www.stdutility.com/articles/djvu.html
---

I extracted the images using the following commands:
ddjvu -page=11 -format=pdf -mode=mask questofhistorica00schwrich.djvu 11-mask.pdf
ddjvu -page=11 -format=pdf -mode=foreground questofhistorica00schwrich.djvu 11-foreground.pdf
ddjvu -page=11 -format=pdf -mode=background questofhistorica00schwrich.djvu 11-background.pdf
---

ddjvu stands for ‘djvu decode’ and is available in the DjVuLibre package.
http://djvu.sourceforge.net/




Attachment: 11-mask.pdf
Attachment: 11-foreground.pdf

Reply to this post
Reply [edit]

Poster: martyveldman Date: Apr 5, 2013 1:59pm
Forum: forums Subject: Re: DjVu

Thanks aibek, but you lost me after "A nice idea" Many of us have not travelled this way before. I would need a step-by-step lesson to arrive at your destination. You can email me at martyveldman@sbcglobal.net if that would be easier.

Reply to this post
Reply [edit]

Poster: aibek Date: Apr 5, 2013 8:31pm
Forum: forums Subject: Re: DjVu

Hi martyveldman,

Did you check the two links at the bottom of my previous post? I referenced much from those.

A step-by-step solution is simple enough.
1) Install DjVuLibre. (A windows version is available too.)
2) Navigate to the directory which contains your djvu file (say, X.djvu), and then issue the command:
ddjvu -format=pdf -mode=mask X.djvu output.pdf
3) An output.pdf file will be created in the same directory. This is the desired file.

A reply here is more useful as others may be able to use it too.

---
What Operating System do you use? If you use Windows, you may not have used the command prompt.

Step 2 in Windows:
2(a) Move the file to a conveniently accessed Folder, say C:\Downloads. (Copy from the current location, and Paste in C:\Downloads in the normal way -- using mouse, right-click, etc.)

2(b) Start the command prompt, as shown on the next link.
http://dosprompt.info/

2(c) Type:
cd c:\Downloads
(This changes the "working directory". Now Windows will assume that all the files you are referencing are in this folder.)

2(d) Type:
ddjvu -format=pdf -mode=mask X.djvu output.pdf
(Change X.djvu in the above to the correct filename. Here,
ddjvu -format=pdf -mode=mask questofhistorica00schwrich.djvu output.pdf )

I do not use Windows, and I have not used the DjVuLibre Windows package, so I am not sure that my instructions are correct. If it does not work, please tell, I will look around for what is wrong.

Terms of Use (10 Mar 2001)